Skip to content

docs: logical DIP coordinate space contract - #21

Merged
kolkov merged 1 commit into
mainfrom
docs/coordinate-space-contract
Jul 29, 2026
Merged

docs: logical DIP coordinate space contract#21
kolkov merged 1 commit into
mainfrom
docs/coordinate-space-contract

Conversation

@kolkov

@kolkov kolkov commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Documents that all mouse/pointer/scroll coordinates in the EventSource and PointerEvent/ScrollEvent types are in logical DIP (device-independent pixels), consistent with WindowProvider.Size().

Explicitly states: do NOT divide by ScaleFactor() — DPI scaling is applied internally by the framework on all platforms.

Motivation

gogpu#398: @unxed's f4 file manager divided mouse coordinates by ScaleFactor(), causing double-scaling on Windows HiDPI (125%/150%). The existing godoc said "Uses logical pixels (CSS pixels equivalent)" which was technically correct but did not explicitly warn against manual scaling.

Changes

  • events.go — block comment above mouse event methods + per-method "x, y are in logical DIP"
  • pointer.goPointerEvent.X/Y godoc: explicit "Do NOT divide by ScaleFactor"
  • scroll.goScrollEvent.X/Y godoc: "logical DIP, consistent with App.Size()"

Documentation only — zero code changes.

Test plan

  • go build ./...
  • No code changes to test
  • CI

All mouse/pointer/scroll coordinates are in logical DIP (device-independent
pixels), consistent with WindowProvider.Size(). Explicitly document that
callers should NOT divide by ScaleFactor — DPI scaling is applied internally
by the framework on all platforms.

Motivated by gogpu#398: user double-scaled coordinates because the godoc
did not clearly state the coordinate space contract.
@codecov

codecov Bot commented Jul 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@kolkov
kolkov merged commit 7965adb into main Jul 29, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant